﻿using System;

namespace SharePoint.Contrib.ApplicationSettings
{
    /// <summary>
    /// A setting is a key/value pair that is persisted in SharePoint.
    /// </summary>
    [Serializable]
    public class Setting<T>
    {
        /// <summary>
        /// Setting: Id (aka key)
        /// </summary>
        public string Id { get; internal set; }

        /// <summary>
        /// Setting: value
        /// </summary>
        public T Value { get; set; }

        public Setting(string id)
        {
            this.Id = id;
        }

        /// <summary>
        /// Required constructor for serialization
        /// </summary>
        public Setting()
        {
        }

    }

    /// <summary>
    /// Setting is a setting where the value is always an object.
    /// </summary>
    [Serializable]
    public class Setting : Setting<object>
    {
        public Setting(string id)
            :base(id)
        {
        }

        public Setting()
            :base()
        {
        }
    }
    
}
